fix(app-shell): 把 System Settings 指向系统枢纽 /apps/setup/system,而非空态自己的裸 URL - #3608
Merged
Conversation
…f the bare setup URL (#3590) The system hub mounts only under `isSystemRoute`, which keys on a `/system` path segment. A bare `/apps/setup` matched no pseudo-route except `isSetupRoute`, so on a zero-app deployment it fell straight back into the "No Apps Configured" guard — it IS that empty state's own URL, and the empty state's `go-to-settings-btn` re-rendered the screen it sits on. Retargets three call sites at `/apps/setup/system`, which resolves in both branches (`extraRoutesNoApp` with no active app, `extraRoutes` once one exists), and which every sibling entry of both `sys-*` clusters already prefixes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
yinlianghui
marked this pull request as ready for review
August 7, 2026 15:56
This was referenced Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3590
问题
AppContent只在isSystemRoute成立时挂载系统枢纽,而isSystemRoute = location.pathname.includes('/system')。裸/apps/setup除isSetupRoute外不满足任何伪路由判定,于是零应用部署下直接落回!activeApp && !isCreateAppRoute && !isSystemRoute && !isMetadataRoute这条守卫 —— 它就是「No Apps Configured」空态自己的 URL,所以空态上的go-to-settings-btn点完只是把同一屏重渲染了一遍。/apps/setup/system在两个分支里都能解析:无 activeApp 时走extraRoutesNoApp,有 activeApp 时走extraRoutes—— console 把同一份systemRoutes(首项即path="system"→SystemHubPage)同时传给了这两个 prop。三个调用点,逐点测量与处置
1.
console/AppContent.tsx的go-to-settings-btn(主修点,已改)该按钮只在空态分支里渲染,而空态只在无 activeApp 时出现 —— 也就是说它的旧目标恒等于它自身所在屏的 URL。100% 死键,无歧义。
2.
layout/AppSidebar.tsx的systemFallbackNavigation.sys-settings(已改)该簇只在
activeApp为假时渲染,而此处activeApp = matched || activeApps[0],仅当部署里没有任何 active+visible 应用时才为假 —— 恰好就是零应用部署。也就是说,这个簇的头项在这个簇唯一存在的场景里是死的。簇内其余 8 项本就全部拼/apps/setup/system/...,头项是唯一的异类。新测试直接断言其渲染出的 href。3.
layout/UnifiedSidebar.tsx的homeNavigationAdministration 簇里的sys-settings(已改,但当前休眠 —— 见下)语义与 2 相同:该簇的代码注释写明它是为「fresh env(还没有 app)在
/home上仍有真菜单」而加的,而resolveLandingPath([])正是把零应用用户送到/home。同一个头项、同一个裸 URL、同一条死路,因此同改。测试
扩展 #3588 新增的
console/__tests__/AppContent.noAppsCta.test.tsx(未另起文件),并新增一个侧边栏目标测试文件layout/__tests__/systemNavSettingsTarget.test.tsx。被重写的那条钉:原
leaves the sibling go-to-settings CTA on its absolute /apps/setup target(断言点击后pathname === '/apps/setup'且create-first-app-btn仍在)。它的注释本就写明「pinning, not blessing」—— 存在的意义只是证明 #3573 没碰这颗按钮。本 PR 整条替换为断言落到系统枢纽,并额外要求空态必须消失(只断 URL 的话,一个什么都不渲染的目标同样会绿)。harness 里按 console 宿主的写法接上了
extraRoutesNoApp,所以「点击 → 枢纽真的挂载」是端到端量出来的,不是只比对字符串。反向验证(方向在跑之前先写下):把三处源码改动
git apply -R掉、只保留新测试 —— 预测 3 红 6 绿,实测完全一致:其中 UnifiedSidebar 那条 MEASUREMENT 钉按预测保持绿色:它钉的是「home 分支压平组」,与 URL 常量无关 —— 这正是 UnifiedSidebar 那处改动休眠的原因。把它报成红色会是编造。
改动后:
越界发现(只报不改,已另立 unassigned 单)
/home的 Administration 组被压平成一条指向/home的死链,整簇 9 个系统管理入口在参考 console 上完全不可达。sys-objects/sys-datasources经/apps/setup/component/...落到无 activeApp 分支,该分支既无component/*路由也无 catch-all,渲染空白屏。/apps/setup的同族调用点(AppSidebar 无应用侧栏头 + 用户菜单 Settings、ConsoleShell 的/system旧链重定向、以及从未被渲染的 QuickActions)。备注
SystemHubPage自身标了@deprecated(「新管理面应做成 nav 项而非手写卡片」)。这不影响本次改向:它仍是system路由上唯一挂载的页面,也是整个sys-*簇共同的前缀;而零应用恰恰是「元数据驱动左侧菜单」尚不存在、因而这个枢纽正当其用的场景。